Subject: Re: auto int array[n]
From: [email-masked] (Bruce Stephens)
Date: Thu, 3 Mar 1994 10:55:36 GMT
Newsgroups: alt.lang.cfutures,comp.lang.c

>>>>> On Tue, 1 Mar 1994 17:17:39 GMT, [email-masked] (Lou Sanchez-Chopitea) said:

>     Probably because it's not needed.

>     void foo (int n)
>     {
>         int *pi;

>         pi = calloc( n, sizeof( *pi));
>         ...;
>         free( pi);
>     }

That's all very well, but I still find "int pi[n]" more readable.
More generally, it would be of great benefit to be able to write
"double a[n][m]", where n and m are only known at runtime.

Notice that C doesn't even have Fortran's facility with 2-d arrays:
you can't write

void foo(int n, double a[][n]);

Fortunately, the ANSI C committee is working on it, and at least one
compiler (GCC) supports this already (together with int pi[n]).
--
Bruce                    Institute of Advanced Scientific Computation
[email-masked]    University of Liverpool